package com.netty.task;

import com.netty.exception.TaskTypeException;
import com.netty.model.Service;
import com.netty.model.Util;

public class TaskFactory {

	public static Task createTaskByType(byte[] packet) throws TaskTypeException {
		int packetType = Util.bytes2int(packet, 4);
		if (packetType == Service.PACKET_TYPE.C2S_LOGON) {
			return new LoginTask(packet);
		}
		throw new TaskTypeException();
	}
}
